home *** CD-ROM | disk | FTP | other *** search
/ Collection of Tools & Utilities / Collection of Tools and Utilities.iso / edit / mg2a_src.zip / SYS / VMS / UNIXFNS.MAR < prev   
Text File  |  1988-08-23  |  938b  |  39 lines

  1.     .title    unixfns    MG access to Unix library functions
  2. ;
  3. ;    bcopy by Mic Kaczmarczik, July 11, 1986
  4. ;    everything else by Peter Newton April 24, 1987
  5. ;
  6. ; UNIX stack-based memory allocation
  7. ;
  8.     .entry    alloca,^m<>
  9.     movl    4(ap),r0        ; number of bytes
  10.     movl    16(fp),r1        ; return address
  11.     moval    alloca_reenter,16(fp)    ; return to reenter code
  12.     ret
  13. alloca_reenter:
  14.     addl    #3,r0            ; round up byte count to
  15.     bicl    #3,r0            ;   longword boundary
  16.     subl    r0,sp            ; allocate stack space
  17.     moval    (sp),r0            ; address of allocated block
  18.     jmp    (r1)            ; return to caller
  19. ;
  20. ; UNIX bcmp function
  21. ;
  22.     .entry    bcmp,^m<r2,r3>
  23.     cmpc3    12(ap),@4(ap),@8(ap)
  24.     ret
  25. ;
  26. ;  UNIX bcopy function
  27. ;
  28.     .entry    bcopy,^m<r2,r3,r4,r5>    ; MOVC3 side-effects r0-r5
  29.     subl2    #4,sp            ; Step over call frame
  30.     movc3    12(ap),@4(ap),@8(ap)    ; Copy them bytes
  31.     ret                ; Bye!
  32. ;
  33. ; UNIX bzero function
  34. ;
  35.     .entry    bzero,^m<r2,r3,r4,r5>
  36.     movc5    #0,(r0),#0,8(ap),@4(ap)
  37.     ret
  38.     .end
  39.